package com.demo.view;

import javax.swing.*;
import java.awt.*;

public class MainViewPanel extends JPanel {
    /** 主面板的界面宽度 */
    public static int WIDTH = 300;
    /** 主面板的界面高度 */
    public static int HEIGHT = 430;

    private static final MainViewPanel instance = new MainViewPanel();

    private final ScoreView scoreView = new ScoreView();

    private MainViewPanel() {
        setPreferredSize(new Dimension(WIDTH, HEIGHT));
        setBackground(Color.decode("#dd5aa5"));
        // layout
        setLayout(new BorderLayout());
        // 2048卡片画板载入
        add(CardsView.getInstance(), BorderLayout.SOUTH);
        // 计分板载入
        add(scoreView, BorderLayout.NORTH);
    }

    public static MainViewPanel getInstance() {
        return instance;
    }

    public static ScoreView getScoreView() {
        return getInstance().scoreView;
    }

}